package com.work.tqyb.ui.activity;

import androidx.lifecycle.ViewModelProvider;

import com.work.tqyb.base.BaseActivity;
import com.work.tqyb.databinding.ActivityAir14DayBinding;
import com.work.tqyb.ui.adapter.ActivityAir14DayAdapter;
import com.work.tqyb.vm.AirVM;

public class AirLook14DayActivity extends BaseActivity {

    private ActivityAir14DayBinding binding;
    private ActivityAir14DayAdapter adapter;
    private AirVM vm;

    @Override
    public void initData() {
        vm = new ViewModelProvider(this).get(AirVM.class);
        adapter = new ActivityAir14DayAdapter();
        binding = ActivityAir14DayBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        binding.ibnBack.setOnClickListener(v -> finish());
        binding.lv.setAdapter(adapter);
        String id = getIntent().getStringExtra("id");
        vm.airHistory(id);

    }

    @Override
    public void onViewClick() {

    }

    @Override
    public void observe() {
        vm.getAirHistoryLD().observe(this, cityAirInfoBeans -> {
            adapter.cityList = cityAirInfoBeans;
            adapter.notifyDataSetChanged();
        });

    }
}
